package model;

import utils.Stemmer;

public class Query {
	String query;

	public Query(String query) {
		this.query = query;
	}

	public String[] toArray(boolean stemming) {
		String[] terms = query.split("\\s");

		for (int i = 0; i < terms.length; i++) {
			terms[i] = terms[i].toLowerCase();
			if (stemming) {
				Stemmer s = new Stemmer();
				terms[i] = s.stem(terms[i]);
			}
		}
		return terms;

	}

	public static void main(String args[]) {
		String[] test = (new Query(
				"Find documents stating opinions about Apple CEO Steve Jobs"))
				.toArray(true);
		for (String str : test) {
			System.out.println(str);
		}
	}

}
